import { OrderService } from './../../service/order/order.service';
import { AddressService } from './../../service/address/address.service';
import { AddressSchema } from './../../schema/address.schema';
import { UserTempService } from './../../service/user-temp/user-temp.service';
import { UserService } from 'src/service/user/user.service';
import { UserTempSchema } from 'src/schema/user_temp.schema';
import { CacheService } from 'src/service/cache/cache.service';
import { BombingService } from 'src/service/bombing/bombing.service';
import { BomBingSchema } from 'src/schema/bombing.schema';

import { ShopSettingService } from 'src/service/shop-setting/shop-setting.service';
import { NavService } from 'src/service/nav/nav.service';
import { GoodsImageService } from 'src/service/goods-image/goods-image.service';
import { GoodsAttrService } from 'src/service/goods-attr/goods-attr.service';
import { GoodsColorService } from 'src/service/goods-color/goods-color.service';
import { GoodsService } from 'src/service/goods/goods.service';
import { GoodsCateService } from 'src/service/goods-cate/goods-cate.service';
import { GoodsTypeService } from 'src/service/goods-type/goods-type.service';
import { FocusService } from 'src/service/focus/focus.service';
import { RoleAccessService } from 'src/service/role_access/role_access.service';
import { RoleService } from 'src/service/role/role.service';
import { AdminService } from 'src/service/admin/admin.service';
import { ToolsService } from 'src/service/tools/tools.service';
import { AccessService } from 'src/service/access/access.service';
import { GoodsTypeAttributeService } from 'src/service/goods-type-attribute/goods-type-attribute.service';
import { XfOcrService } from 'src/service/xf-ocr/xf-ocr.service';

import { GoodsTypeAttributeSchema } from 'src/schema/goods_type_attribute.schema';
import { GoodsTypeSchema } from 'src/schema/goods_type.schema';
import { FocusSchema } from 'src/schema/focus.schema';
import { RoleAccessSchema } from 'src/schema/role_access.schema';
import { AccessSchema } from 'src/schema/access.schema';
import { RoleSchema } from 'src/schema/role.schema';
import { AdminSchema } from 'src/schema/admin.schema';
import { GoodsCateSchema } from 'src/schema/goods_cate.schema';
import { GoodsSchema } from 'src/schema/goods.schema';
import { GoodsColorSchema } from 'src/schema/goods_color.schema';
import { GoodsAttrSchema } from 'src/schema/goods_attr.schema';
import { GoodsImageSchema } from 'src/schema/goods_image.schema';
import { NavSchema } from 'src/schema/nav.schema';
import { ShopSettingSchema } from 'src/schema/shop_setting.schema';
import { MongooseModule } from '@nestjs/mongoose';

import config from 'src/config/config';
import { RedisModule } from '@liaoliaots/nestjs-redis';
import { HttpModule } from '@nestjs/axios';
import { Module } from '@nestjs/common';
import { CookieService } from 'src/service/cookie/cookie.service';
import { UserSchema } from 'src/schema/user.schema';
import { OrderSchema } from 'src/schema/order.schema';
import { OrderItemSchema } from 'src/schema/order_item.schema';

@Module({
    imports: [
        MongooseModule.forFeature([
            { name: 'Admin', schema: AdminSchema, collection: 'admin' },
            { name: 'Role', schema: RoleSchema, collection: 'role' },
            { name: 'Access', schema: AccessSchema, collection: 'access' },
            { name: 'RoleAccess', schema: RoleAccessSchema, collection: 'role_access' },
            { name: 'Focus', schema: FocusSchema, collection: 'focus' },
            { name: 'GoodsType', schema: GoodsTypeSchema, collection: 'goods_type' },
            { name: 'GoodsTypeAttribute', schema: GoodsTypeAttributeSchema, collection: 'goods_type_attribute' },
            { name: 'GoodsCate', schema: GoodsCateSchema, collection: 'goods_cate' },
            { name: 'Goods', schema: GoodsSchema, collection: 'goods' },
            { name: 'GoodsColor', schema: GoodsColorSchema, collection: 'goods_color' },
            { name: 'GoodsAttr', schema: GoodsAttrSchema, collection: 'goods_attr' },
            { name: 'GoodsImage', schema: GoodsImageSchema, collection: 'goods_image' },
            { name: 'Nav', schema: NavSchema, collection: 'nav' },
            { name: 'ShopSetting', schema: ShopSettingSchema, collection: 'shop_setting' },
            { name: 'Bombing', schema: BomBingSchema, collection: 'bombing' },
            { name: 'User', schema: UserSchema, collection: 'user' },
            { name: 'UserTemp', schema: UserTempSchema, collection: 'user_temp' },
            { name: 'Address', schema: AddressSchema, collection: 'address' },
            { name: 'Order', schema: OrderSchema, collection: 'order' },
            { name: 'OrderItem', schema: OrderItemSchema, collection: 'order_item' },
        ]),
        RedisModule.forRoot({ config: config.redisOptions, readyLog: true }, true),
        HttpModule.register(config.httpModuleOptions),
    ],
    providers: [
        ToolsService,
        AdminService,
        RoleService,
        AccessService,
        RoleAccessService,
        FocusService,
        GoodsTypeService,
        GoodsTypeAttributeService,
        GoodsCateService,
        GoodsService,
        GoodsColorService,
        GoodsAttrService,
        GoodsImageService,
        NavService,
        ShopSettingService,
        BombingService,
        CacheService,
        XfOcrService,
        CookieService,
        UserService,
        UserTempService,
        AddressService,
        OrderService,
    ],
    exports: [
        ToolsService,
        AdminService,
        RoleService,
        AccessService,
        RoleAccessService,
        FocusService,
        GoodsTypeService,
        GoodsTypeAttributeService,
        GoodsCateService,
        GoodsService,
        GoodsColorService,
        GoodsAttrService,
        GoodsImageService,
        NavService,
        ShopSettingService,
        BombingService,
        CacheService,
        XfOcrService,
        CookieService,
        UserService,
        UserTempService,
        AddressService,
        OrderService,
    ],
})
export class CommonModule {}
